package com.julius.design.pattern.filter;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *
 * </p>
 */
public class FilterTest {


    public static void main(String[] args) {

        List<Person> personList = new ArrayList<>();
        personList.add(new Person("C罗",37,1));
        personList.add(new Person("梅西",33,1));
        personList.add(new Person("内马尔",31,1));
        personList.add(new Person("国足",1,1));
        personList.add(new Person("女足",19,0));



        NameFilter nameFilter = new NameFilter();
        System.out.println(nameFilter.filter(personList).size());
        
        AgeFilter ageFilter = new AgeFilter();
        System.out.println(ageFilter.filter(personList).size());
        
        SexFilter sexFilter = new SexFilter();
        System.out.println(sexFilter.filter(personList).size());
        
        
        AndFilter andFilter = new AndFilter(nameFilter,ageFilter);
        System.out.println(andFilter.filter(personList).size());

        OrFilter orFilter = new OrFilter(ageFilter,sexFilter);
        System.out.println(orFilter.filter(personList).size());
    }
}
